﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crosland.Offline.Core;
using System.Data;
using Crosland.Framework.Base;

namespace Crosland.Offline.Data.Helper
{
    public  class InterlocutoresHelper : DaoHelperBase
    {
        public InterlocutoresHelper()
            : base(Entidad, ConstansBase.Aplicacion)
        {
        }

        public Interlocutores Create(IDataReader dr)
        {
            Interlocutores entity = new Interlocutores();

            int iKunnr = dr.GetOrdinal(this.Kunnr);
            if (!dr.IsDBNull(iKunnr)) entity.Kunnr = dr.GetString(iKunnr);

            int iVkorg = dr.GetOrdinal(this.Vkorg);
            if (!dr.IsDBNull(iVkorg)) entity.Vkorg = dr.GetString(iVkorg);

            int iVtweg = dr.GetOrdinal(this.Vtweg);
            if (!dr.IsDBNull(iVtweg)) entity.Vtweg = dr.GetString(iVtweg);

            int iSpart = dr.GetOrdinal(this.Spart);
            if (!dr.IsDBNull(iSpart)) entity.Spart = dr.GetString(iSpart);

            int iParvw = dr.GetOrdinal(this.Parvw);
            if (!dr.IsDBNull(iParvw)) entity.Parvw = dr.GetString(iParvw);

            int iKunn2 = dr.GetOrdinal(this.Kunn2);
            if (!dr.IsDBNull(iKunn2)) entity.Kunn2 = dr.GetString(iKunn2);

            return entity;
        }


        #region Mapeo de Campos

        public const string Entidad = "Interlocutores";
        public string Kunnr = "KUNNR";
        public string Vkorg = "VKORG";
        public string Vtweg = "VTWEG";
        public string Spart = "SPART";
        public string Parvw = "PARVW";
        public string Kunn2 = "KUNN2";

        #endregion
    }
}
